package com.huike.eventbus;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import org.greenrobot.eventbus.EventBus;

public class NextActivity extends AppCompatActivity {

    private Button mButNextCommon;
    private Button mButNextStick;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_next);

        mButNextCommon = (Button) findViewById(R.id.but_next_common);
        mButNextStick = (Button) findViewById(R.id.but_next_stick);

//        发送普通事件
        mButNextCommon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventBus.getDefault().post(new Beas("小名"));
            }
        });

        mButNextStick.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               EventBus.getDefault().postSticky(new Beas("ssss"));
            }
        });

    }
}
